<template>
	<view class="main">
		<view class="order-information" v-for="(item, index) in dataList" :key="index">
			<view v-if="item.type == 1 || item.type == 2" class="order_box" @click="showDetail(index)">
				<view class="number">订单号：{{ item.order_no }}</view>
				<view class="iconfont iconfont-e775"></view>
			</view>
			<view class="order-local">
				<view class="type_title u-line-1">{{ typeFilter[item.type] }}</view>
				<view class="status">{{ statusFilter(item.status, item.is_cash,item.type) }}</view>
			</view>
			<view class="name" v-if="item.nickname?true:false">昵称：{{item.nickname}}</view>
			<view class="name" style="padding-top: 6rpx;">金额：￥{{item.total_amount}}</view>
			<view class="information_box">
				<view class="time_price">
					<view class="information-title u-line-1">日期：{{ item.date_creation | formTime }}</view>
					<view class="consumer-money">
						<text class="sign">￥</text>
						<text class="num">{{ item.amount || 0 }}</text>
					</view>
				</view>
				<view class="information-title">备注：{{ item.remark || '' }}</view>
			</view>
		</view>
		<u-popup v-model="detailVisible" mode="center" border-radius="10">
			<view>
				<view class="post_detail" v-for="(i, idx) in dataListDetail" :key="idx">
					<view class="prod_title">{{ i.product_name }}</view>
					<view class="detail_cont">
						<!-- <view>规格：甘草干姜（儿童）</view> -->
						<view class="price_box">
							<view class="price_num">￥{{ i.price }}</view>
							<view>数量：{{ i.num }}</view>
						</view>
					</view>
				</view>
			</view>
		</u-popup>
	</view>
</template>

<script>
	import {
		formatDate
	} from '@/utils/moment/index.js';
	export default {
		components: {},
		props: {
			dataList: {
				type: Array,
				default: []
			}
		},
		data() {
			return {
				typeFilter: {
					1: '订单返佣',// (分销、分红)一级返佣
					2: '订单返佣',// (分销、分红)二级返佣
					3: '提现余额', // 佣金提现
					4: '提现微信',
					5: '返佣',// 分红奖金
					6: '提现微信',// 分红的
				},
				detailVisible: false,
				dataListDetail: []
			};
		},
		filters: {
			formTime(time) {
				return formatDate(time, 'YYYY-MM-DD HH:mm:ss');
			}
		},
		computed: {
			statusFilter(status, is_cash, type) {
				return (status, is_cash, type) => {
					if (status == 1) {
						if (type == 3 || type == 4 || type == 6) {
							/**分销、分红佣金*/
							return '已到账'
						}else {
							return is_cash == 1 ? '可提现' : '未核销';
						}
					} else {
						return status == 2 ? '已退回' : '未到账'
					}
				};
			}
		},

		methods: {
			// 查看详情
			showDetail(index) {
				// (this.dataListDetail = Array.isArray(this.dataList[index].detailed) ? this.dataList[index].detailed : []), console.log('dataListDetail', this.dataListDetail);
				// this.detailVisible = true;
			}
		}
	};
</script>

<style scoped lang="scss">
	.main {
		margin-top: 10rpx;
	}

	.order-information {
		margin-bottom: 20rpx;
		padding-bottom: 10rpx;
		padding: 0 30rpx 20rpx;
		background: #fff;

		.order_box {
			display: flex;
			align-items: center;
			justify-content: space-between;
			height: 80rpx;
			border-bottom: 1rpx solid #e6e6e6;

			.number {
				color: #999;
				font-size: 26rpx;
			}

			.iconfont {
				color: #999;
			}
		}

		.order-local {
			display: flex;
			align-items: center;
			padding-top: 10rpx;

			.type_title {
				line-height: 70rpx;
				font-size: 30rpx;
				flex: 1;
				overflow: hidden;
			}

			.status {
				color: var(--color);
				font-size: 26rpx;
			}
		}

		.name {
			font-size: 26rpx;
			color: #999999;
		}

		.information_box {
			font-size: 26rpx;
			color: #999999;
			line-height: 50rpx;

			.time_price {
				display: flex;
				justify-content: space-between;

				.consumer-money {
					text-align: right;
					color: var(--price);

					.sign {
						font-size: 24rpx;
					}

					.num {
						font-size: 28rpx;
						font-weight: bold;
					}
				}

				.information-title {
					flex: 1;
					overflow: hidden;
				}
			}
		}

		.information-title {
			font-size: 26rpx;
			color: #999999;
		}
	}

	.post_detail {
		width: 600rpx;
		padding: 10rpx 20rpx;
		min-height: 200rpx;

		.prod_title {
			line-height: 50rpx;
			font-size: 32rpx;
		}

		.detail_cont {
			color: #999;
			font-size: 28rpx;
			margin-top: 20rpx;

			.price_box {
				display: flex;
				align-items: center;
				margin-top: 50rpx;
				justify-content: space-between;
				padding-right: 10rpx;

				.price_num {
					display: flex;
					color: var(--price);
					font-size: 34rpx;
					font-weight: bold;
				}
			}
		}
	}
</style>
